﻿namespace Infrastructure
{
    /// <summary>
    /// 创建继承sql仓储
    /// </summary>
    public class BaseSqlRepository
    {
        #region 表Flow

        /// <summary>
        /// Flow 新增
        /// </summary>
        public static string flow_insertSql = @"insert into Flow (FlowId,FormId,DepartmentId,FlowContent,FlowName,Remark,TypeId,DataState,CreateTime,CreateUserKey) values(@FlowId,@FormId,@DepartmentId,@FlowContent,@FlowName,@Remark,@TypeId,@DataState,@CreateTime,@CreateUserKey)";

        /// <summary>
        /// Flow 更新
        /// </summary>
        public static string flow_updateSql = @"update Flow set FormId=@FormId,DepartmentId=@DepartmentId,FlowContent=@FlowContent,FlowName=@FlowName,Remark=@Remark,TypeId=@TypeId,DataState=@DataState,CreateTime=@CreateTime,CreateUserKey=@CreateUserKey where FlowId = @FlowId";

        /// <summary>
        /// Flow 查询
        /// </summary>
        public static string flow_selectByKeySql = @" select * from Flow where  FlowId=@Key ";

        /// <summary>
        /// Flow 表查询全部语句
        /// </summary>
        public static string flow_selectAllSql = @" select * from Flow";

        /// <summary>
        /// Flow 删除
        /// </summary>
        public static string flow_delete = @" delete from  Flow where FlowId=@Key";

        #endregion

        #region 表FlowNodeConfig

        /// <summary>
        /// FlowNodeConfig 新增
        /// </summary>
        public static string flowNodeConfig_insertSql = @"insert into FlowNodeConfig (Id,FlowId,FormId,FlowNodeId,NodeType,ExpireConfig,IsExpireRemind,FieldAuthConfig,CreateTime,CreateUserKey) values(@Id,@FlowId,@FormId,@FlowNodeId,@NodeType,@ExpireConfig,@IsExpireRemind,@FieldAuthConfig,@CreateTime,@CreateUserKey)";

        /// <summary>
        /// FlowNodeConfig 更新
        /// </summary>
        public static string flowNodeConfig_updateSql = @"update FlowNodeConfig set FlowId=@FlowId,FormId=@FormId,FlowNodeId=@FlowNodeId,NodeType=@NodeType,ExpireConfig=@ExpireConfig,IsExpireRemind=@IsExpireRemind,FieldAuthConfig=@FieldAuthConfig,CreateTime=@CreateTime,CreateUserKey=@CreateUserKey where Id = @Id";

        /// <summary>
        /// FlowNodeConfig 查询
        /// </summary>
        public static string flowNodeConfig_selectByKeySql = @" select * from FlowNodeConfig where  Id=@Key ";

        /// <summary>
        /// FlowNodeConfig 表查询全部语句
        /// </summary>
        public static string flowNodeConfig_selectAllSql = @" select * from FlowNodeConfig";

        /// <summary>
        /// FlowNodeConfig 删除
        /// </summary>
        public static string flowNodeConfig_delete = @" delete from  FlowNodeConfig where Id=@Key";

        #endregion

        #region 表Form

        /// <summary>
        /// Form 新增
        /// </summary>
        public static string form_insertSql = @"insert into Form (FormId,DepartmentId,FormJson,FormData,FormName,FormRemark,TypeId,DataState,CreateTime,CreateUserKey) values(@FormId,@DepartmentId,@FormJson,@FormData,@FormName,@FormRemark,@TypeId,@DataState,@CreateTime,@CreateUserKey)";

        /// <summary>
        /// Form 更新
        /// </summary>
        public static string form_updateSql = @"update Form set DepartmentId=@DepartmentId,FormJson=@FormJson,FormData=@FormData,FormName=@FormName,FormRemark=@FormRemark,TypeId=@TypeId,DataState=@DataState,CreateTime=@CreateTime,CreateUserKey=@CreateUserKey where FormId = @FormId";

        /// <summary>
        /// Form 查询
        /// </summary>
        public static string form_selectByKeySql = @" select * from Form where  FormId=@Key ";

        /// <summary>
        /// Form 表查询全部语句
        /// </summary>
        public static string form_selectAllSql = @" select * from Form";

        /// <summary>
        /// Form 删除
        /// </summary>
        public static string form_delete = @" delete from  Form where FormId=@Key";

        #endregion

        #region 表LoginLog

        /// <summary>
        /// LoginLog新增
        /// </summary>
        public static string loginLog_insertSql = @"insert into LoginLog (Id,CorporationKey,UserId,Ip,Country,Prov,City,Area,Isp,Lng,Lat,CreateTime,CreateUser) values(@Id,@CorporationKey,@UserId,@Ip,@Country,@Prov,@City,@Area,@Isp,@Lng,@Lat,@CreateTime,@CreateUser)";

        /// <summary>
        /// LoginLog查询
        /// </summary>
        public static string loginLog_selectByKeySql = @" select * from LoginLog where  Id=@Key";

        /// <summary>
        /// LoginLog表查询全部语句
        /// </summary>
        public static string loginLog_selectAllSql = @" select * from LoginLog";

        #endregion


        #region 表FlowApply

        /// <summary>
        /// FlowApply 新增
        /// </summary>
        public static string flowApply_insertSql = @"insert into FlowApply (FlowApplyId,ApplyTitle,FlowId,FormId,FormData,FlowContent,IsPublish,FlowApplyState,CurrentNodeId,CurrentNodeName,
                                                            CurrentNodeReviewerId,CurrentNodeReviewerName,CurrentNodeState,CurrentNodeUpdateTime,NextNodeId,NextNodeName,NextNodeReviewerId,NextNodeReviewerName,
                                                            CreateTime,CreateUserKey,UrgentIndex,Remark,DataState) values(@FlowApplyId,@ApplyTitle,@FlowId,@FormId,@FormData,@FlowContent,@IsPublish,@FlowApplyState,@CurrentNodeId,@CurrentNodeName,
                                                            @CurrentNodeReviewerId,@CurrentNodeReviewerName,@CurrentNodeState,@CurrentNodeUpdateTime,@NextNodeId,@NextNodeName,@NextNodeReviewerId,@NextNodeReviewerName,
                                                            @CreateTime,@CreateUserKey,@UrgentIndex,@Remark,@DataState)";

        /// <summary>
        /// FlowApply 更新
        /// </summary>
        public static string flowApply_updateSql = @"update FlowApply set FlowApplyId=@FlowApplyId,ApplyTitle=@ApplyTitle,FlowId=@FlowId,FormId=@FormId,IsPublish=@IsPublish,FlowApplyState=@FlowApplyState,FormData=@FormData,FlowContent=@FlowContent,CurrentNodeId=@CurrentNodeId,
                                                            CurrentNodeName=@CurrentNodeName,CurrentNodeReviewerId=@CurrentNodeReviewerId,CurrentNodeReviewerName=@CurrentNodeReviewerName,CurrentNodeState=@CurrentNodeState,CurrentNodeUpdateTime=@CurrentNodeUpdateTime,NextNodeId=@NextNodeId,
                                                            NextNodeName=@NextNodeName,NextNodeReviewerId=@NextNodeReviewerId,NextNodeReviewerName=@NextNodeReviewerName,
                                                          UrgentIndex=@UrgentIndex,Remark=@Remark,DataState=@DataState where FlowApplyId = @FlowApplyId";

        /// <summary>
        /// FlowApply 查询
        /// </summary>
        public static string flowApply_selectByKeySql = @" select * from FlowApply where  FlowApplyId=@Key ";

        /// <summary>
        /// FlowApply 表查询全部语句
        /// </summary>
        public static string flowApply_selectAllSql = @" select * from FlowApply";

        /// <summary>
        /// FlowApply 删除
        /// </summary>
        public static string flowApply_delete = @" delete from  FlowApply where FlowApplyId=@Key";

        #endregion

        #region 表FlowApplyRecord

        /// <summary>
        /// FlowApplyRecord 新增
        /// </summary>
        public static string flowApplyRecord_insertSql = @"insert into FlowApplyRecord (FlowApplyRecordId,FlowApplyId,NodeId,RejectNodeIds,NodeName,NodeType,NodeReviewerId,NodeReviewerName,NodeExamineState,
                                                            CreateTime,CreateUserKey,ExamineRemark) values(@FlowApplyRecordId,@FlowApplyId,@NodeId,@RejectNodeIds,@NodeName,@NodeType,@NodeReviewerId,@NodeReviewerName,@NodeExamineState,
                                                            @CreateTime,@CreateUserKey,@ExamineRemark)";

        /// <summary>
        /// FlowApplyRecord 更新
        /// </summary>
        public static string flowApplyRecord_updateSql = @"update FlowApplyRecord set FlowApplyRecordId=@FlowApplyRecordId, FlowApplyId=@FlowApplyId,
                                                            NodeId=@NodeId,RejectNodeIds=@RejectNodeIds,NodeName=@NodeName,NodeType=@NodeType,NodeReviewerId=@NodeReviewerId,NodeReviewerName=@NodeReviewerName,NodeExamineState=@NodeExamineState,
                                                            ExamineRemark=@ExamineRemark where FlowApplyRecordId = @FlowApplyRecordId";

        /// <summary>
        /// FlowApplyRecord 查询
        /// </summary>
        public static string flowApplyRecord_selectByKeySql = @" select * from FlowApplyRecord where  FlowApplyRecordId=@Key ";

        /// <summary>
        /// FlowApplyRecord 表查询全部语句
        /// </summary>
        public static string flowApplyRecord_selectAllSql = @" select * from FlowApplyRecord";

        /// <summary>
        /// FlowApplyRecord 删除
        /// </summary>
        public static string flowApplyRecord_delete = @" delete from  FlowApplyRecord where FlowApplyRecordId=@Key";

        #endregion


        #region 表FlowMessage

        /// <summary>
        /// FlowMessage 新增
        /// </summary>
        public static string flowMessage_insertSql = @"insert into FlowMessage (MessageId ,MessageTitle,MessageType,MessageContent,MessageRecipient ,MessageSender ,MessageState,FlowApplyId ,NodeId ,NodeName ,IsBrowse,BrowseTime,IsHandled,HandledTime,HandledType,HandledState ,CreateTime,CreateUserKey) values(@MessageId ,@MessageTitle,@MessageType,@MessageContent,@MessageRecipient ,@MessageSender ,@MessageState,@FlowApplyId ,@NodeId ,@NodeName ,@IsBrowse,@BrowseTime,@IsHandled,@HandledTime,@HandledType,@HandledState ,@CreateTime,@CreateUserKey)";

        /// <summary>
        /// FlowMessage 更新
        /// </summary>
        public static string flowMessage_updateSql = @"update FlowMessage set MessageTitle=@MessageTitle,MessageType=@MessageType,MessageContent=@MessageContent,MessageRecipient=@MessageRecipient ,MessageSender=@MessageSender ,MessageState=@MessageState,FlowApplyId=@FlowApplyId ,NodeId=@NodeId ,NodeName=@NodeName ,IsBrowse=@IsBrowse,BrowseTime=@BrowseTime,IsHandled=@IsHandled,HandledTime=@HandledTime,HandledType=@HandledType,HandledState=@HandledState ,CreateTime=@CreateTime,CreateUserKey=@CreateUserKey where MessageId = @MessageId";

        /// <summary>
        /// FlowMessage 查询
        /// </summary>
        public static string flowMessage_selectByKeySql = @" select * from FlowMessage where  MessageId=@Key ";

        /// <summary>
        /// FlowMessage 表查询全部语句
        /// </summary>
        public static string flowMessage_selectAllSql = @" select * from FlowMessage";

        /// <summary>
        /// FlowMessage 删除
        /// </summary>
        public static string flowMessage_delete = @" delete from  FlowMessage where MessageId=@Key";

        #endregion
    }
}
